home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / PInterfaces / ADSP.p < prev    next >
Text File  |  1996-05-01  |  9KB  |  225 lines

  1. {
  2.      File:        ADSP.p
  3.  
  4.      Contains:    AppleTalk Data Stream Protocol (ADSP) Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT ADSP;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __ADSP__}
  28. {$SETC __ADSP__ := 1}
  29.  
  30. {$I+}
  31. {$SETC ADSPIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __ERRORS__}
  35. {$I Errors.p}
  36. {$ENDC}
  37. {$IFC UNDEFINED __APPLETALK__}
  38. {$I AppleTalk.p}
  39. {$ENDC}
  40.  
  41. {$PUSH}
  42. {$ALIGN MAC68K}
  43. {$LibExport+}
  44.  
  45. {$IFC FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED }
  46. { Error Codes have been moved to Errors.(pah)  }
  47. { driver control csCodes }
  48.  
  49. CONST
  50.     dspInit                        = 255;                            {  create a new connection end  }
  51.     dspRemove                    = 254;                            {  remove a connection end  }
  52.     dspOpen                        = 253;                            {  open a connection  }
  53.     dspClose                    = 252;                            {  close a connection  }
  54.     dspCLInit                    = 251;                            {  create a connection listener  }
  55.     dspCLRemove                    = 250;                            {  remove a connection listener  }
  56.     dspCLListen                    = 249;                            {  post a listener request  }
  57.     dspCLDeny                    = 248;                            {  deny an open connection request  }
  58.     dspStatus                    = 247;                            {  get status of connection end  }
  59.     dspRead                        = 246;                            {  read data from the connection  }
  60.     dspWrite                    = 245;                            {  write data on the connection  }
  61.     dspAttention                = 244;                            {  send an attention message  }
  62.  
  63.     dspOptions                    = 243;                            {  set connection end options  }
  64.     dspReset                    = 242;                            {  forward reset the connection  }
  65.     dspNewCID                    = 241;                            {  generate a cid for a connection end  }
  66.                                                                 {  connection opening modes  }
  67.     ocRequest                    = 1;                            {  request a connection with remote  }
  68.     ocPassive                    = 2;                            {  wait for a connection request from remote  }
  69.     ocAccept                    = 3;                            {  accept request as delivered by listener  }
  70.     ocEstablish                    = 4;                            {  consider connection to be open  }
  71.                                                                 {  connection end states  }
  72.     sListening                    = 1;                            {  for connection listeners  }
  73.     sPassive                    = 2;                            {  waiting for a connection request from remote  }
  74.     sOpening                    = 3;                            {  requesting a connection with remote  }
  75.     sOpen                        = 4;                            {  connection is open  }
  76.     sClosing                    = 5;                            {  connection is being torn down  }
  77.     sClosed                        = 6;                            {  connection end state is closed  }
  78.                                                                 {  client event flags  }
  79.     eClosed                        = $80;                            {  received connection closed advice  }
  80.     eTearDown                    = $40;                            {  connection closed due to broken connection  }
  81.     eAttention                    = $20;                            {  received attention message  }
  82.     eFwdReset                    = $10;                            {  received forward reset advice  }
  83.                                                                 {  miscellaneous constants  }
  84.     attnBufSize                    = 570;                            {  size of client attention buffer  }
  85.     minDSPQueueSize                = 100;                            {  Minimum size of receive or send Queue  }
  86.  
  87. {  connection control block  }
  88.  
  89. TYPE
  90.     TRCCBPtr = ^TRCCB;
  91.     TPCCB                                = ^TRCCB;
  92.     TRCCB = PACKED RECORD
  93.         ccbLink:                TPCCB;                                    {  link to next ccb  }
  94.         refNum:                    UInt16;                                    {  user reference number  }
  95.         state:                    UInt16;                                    {  state of the connection end  }
  96.         userFlags:                UInt8;                                    {  flags for unsolicited connection events  }
  97.         localSocket:            UInt8;                                    {  socket number of this connection end  }
  98.         remoteAddress:            AddrBlock;                                {  internet address of remote end  }
  99.         attnCode:                UInt16;                                    {  attention code received  }
  100.         attnSize:                UInt16;                                    {  size of received attention data  }
  101.         attnPtr:                Ptr;                                    {  ptr to received attention data  }
  102.         reserved:                PACKED ARRAY [0..219] OF UInt8;            {  for adsp internal use  }
  103.     END;
  104.  
  105.     ADSPConnectionEventProcPtr = Register68kProcPtr;  { PROCEDURE ADSPConnectionEvent(sourceCCB: TPCCB); }
  106.  
  107.     ADSPCompletionProcPtr = Register68kProcPtr;  { PROCEDURE ADSPCompletion(thePBPtr: DSPPBPtr); }
  108.  
  109.     ADSPConnectionEventUPP = UniversalProcPtr;
  110.     ADSPCompletionUPP = UniversalProcPtr;
  111.     DSPParamBlockPtr = ^DSPParamBlock;
  112.     DSPParamBlock = PACKED RECORD
  113.         qLink:                    QElemPtr;
  114.         qType:                    INTEGER;
  115.         ioTrap:                    INTEGER;
  116.         ioCmdAddr:                Ptr;
  117.         ioCompletion:            ADSPCompletionUPP;
  118.         ioResult:                OSErr;
  119.         ioNamePtr:                StringPtr;
  120.         ioVRefNum:                INTEGER;
  121.         ioCRefNum:                INTEGER;                                {  adsp driver refNum  }
  122.         csCode:                    INTEGER;                                {  adsp driver control code  }
  123.         qStatus:                LONGINT;                                {  adsp internal use  }
  124.         ccbRefNum:                INTEGER;
  125.         CASE INTEGER OF
  126.         0: (
  127.             ccbPtr:                TPCCB;                                    {  pointer to connection control block  }
  128.             userRoutine:        ADSPConnectionEventUPP;                    {  client routine to call on event  }
  129.             sendQSize:            UInt16;                                    {  size of send queue (0..64K bytes)  }
  130.             sendQueue:            Ptr;                                    {  client passed send queue buffer  }
  131.             recvQSize:            UInt16;                                    {  size of receive queue (0..64K bytes)  }
  132.             recvQueue:            Ptr;                                    {  client passed receive queue buffer  }
  133.             attnPtr:            Ptr;                                    {  client passed receive attention buffer  }
  134.             localSocket:        UInt8;                                    {  local socket number  }
  135.             filler1:            UInt8;                                    {  filler for proper byte alignment  }
  136.            );
  137.         1: (
  138.             localCID:            UInt16;                                    {  local connection id  }
  139.             remoteCID:            UInt16;                                    {  remote connection id  }
  140.             remoteAddress:        AddrBlock;                                {  address of remote end  }
  141.             filterAddress:        AddrBlock;                                {  address filter  }
  142.             sendSeq:            UInt32;                                    {  local send sequence number  }
  143.             sendWindow:            UInt16;                                    {  send window size  }
  144.             recvSeq:            UInt32;                                    {  receive sequence number  }
  145.             attnSendSeq:        UInt32;                                    {  attention send sequence number  }
  146.             attnRecvSeq:        UInt32;                                    {  attention receive sequence number  }
  147.             ocMode:                UInt8;                                    {  open connection mode  }
  148.             ocInterval:            UInt8;                                    {  open connection request retry interval  }
  149.             ocMaximum:            UInt8;                                    {  open connection request retry maximum  }
  150.             filler2:            UInt8;                                    {  filler for proper byte alignment  }
  151.            );
  152.         2: (
  153.             abort:                UInt8;                                    {  abort connection immediately if non-zero  }
  154.             filler3:            UInt8;                                    {  filler for proper byte alignment  }
  155.            );
  156.         3: (
  157.             reqCount:            UInt16;                                    {  requested number of bytes  }
  158.             actCount:            UInt16;                                    {  actual number of bytes  }
  159.             dataPtr:            Ptr;                                    {  pointer to data buffer  }
  160.             eom:                UInt8;                                    {  indicates logical end of message  }
  161.             flush:                UInt8;                                    {  send data now  }
  162.            );
  163.         4: (
  164.             attnCode:            UInt16;                                    {  client attention code  }
  165.             attnSize:            UInt16;                                    {  size of attention data  }
  166.             attnData:            Ptr;                                    {  pointer to attention data  }
  167.             attnInterval:        UInt8;                                    {  retransmit timer in 10-tick intervals  }
  168.             filler4:            UInt8;                                    {  filler for proper byte alignment  }
  169.            );
  170.         5: (
  171.             statusCCB:            TPCCB;                                    {  pointer to ccb  }
  172.             sendQPending:        UInt16;                                    {  pending bytes in send queue  }
  173.             sendQFree:            UInt16;                                    {  available buffer space in send queue  }
  174.             recvQPending:        UInt16;                                    {  pending bytes in receive queue  }
  175.             recvQFree:            UInt16;                                    {  available buffer space in receive queue  }
  176.            );
  177.         6: (
  178.             sendBlocking:        UInt16;                                    {  quantum for data packets  }
  179.             sendTimer:            UInt8;                                    {  send timer in 10-tick intervals  }
  180.             rtmtTimer:            UInt8;                                    {  retransmit timer in 10-tick intervals  }
  181.             badSeqMax:            UInt8;                                    {  threshold for sending retransmit advice  }
  182.             useCheckSum:        UInt8;                                    {  use ddp packet checksum  }
  183.            );
  184.         7: (
  185.             newcid:                UInt16;                                    {  new connection id returned  }
  186.            );
  187.     END;
  188.  
  189.     DSPPBPtr                            = ^DSPParamBlock;
  190.  
  191. CONST
  192.     uppADSPConnectionEventProcInfo = $0000B802;
  193.     uppADSPCompletionProcInfo = $00009802;
  194.  
  195. FUNCTION NewADSPConnectionEventProc(userRoutine: ADSPConnectionEventProcPtr): ADSPConnectionEventUPP;
  196.     {$IFC NOT GENERATINGCFM }
  197.     INLINE $2E9F;
  198.     {$ENDC}
  199.  
  200. FUNCTION NewADSPCompletionProc(userRoutine: ADSPCompletionProcPtr): ADSPCompletionUPP;
  201.     {$IFC NOT GENERATINGCFM }
  202.     INLINE $2E9F;
  203.     {$ENDC}
  204.  
  205. PROCEDURE CallADSPConnectionEventProc(sourceCCB: TPCCB; userRoutine: ADSPConnectionEventUPP);
  206.     {$IFC NOT GENERATINGCFM}
  207.     {To be implemented:  Glue to move parameters into registers.}
  208.     {$ENDC}
  209.  
  210. PROCEDURE CallADSPCompletionProc(thePBPtr: DSPPBPtr; userRoutine: ADSPCompletionUPP);
  211.     {$IFC NOT GENERATINGCFM}
  212.     {To be implemented:  Glue to move parameters into registers.}
  213.     {$ENDC}
  214. {$ENDC}
  215. {$ALIGN RESET}
  216. {$POP}
  217.  
  218. {$SETC UsingIncludes := ADSPIncludes}
  219.  
  220. {$ENDC} {__ADSP__}
  221.  
  222. {$IFC NOT UsingIncludes}
  223.  END.
  224. {$ENDC}
  225.